Skip to content

fix(test): set --max-old-space-size=6144 on test:coverage to prevent OOM under --runInBand#3554

Merged
PierreBrisorgueil merged 1 commit intomasterfrom
fix/test-coverage-heap-cap
May 1, 2026
Merged

fix(test): set --max-old-space-size=6144 on test:coverage to prevent OOM under --runInBand#3554
PierreBrisorgueil merged 1 commit intomasterfrom
fix/test-coverage-heap-cap

Conversation

@PierreBrisorgueil
Copy link
Copy Markdown
Contributor

@PierreBrisorgueil PierreBrisorgueil commented May 1, 2026

Summary

  • Adds --max-old-space-size=6144 to test:coverage NODE_OPTIONS
  • Prevents OOM when downstream projects (trawl_node, etc.) run coverage on larger suites
  • Eliminates the need for downstream patches that get silently stripped by /update-stack --theirs

Why

test:coverage runs jest --runInBand — single Node process, no worker children. The workerIdleMemoryLimit: '512MB' added in #3550 only recycles worker processes, so it doesn't apply on coverage runs.

Without an explicit cap, Node defaults to ~2 GB old-space. Devkit's own ~18 suites fit, but trawl_node (214 suites) immediately OOMs at 1.9 GB on the chore/update-stack-2026-05-01 propagation run today.

Trawl had a downstream patch setting 6144 — the recent /update-stack propagation wiped it via --theirs (cf. feedback_update_stack_theirs_wipes_patches), causing the OOM. Restoring it locally would just recreate the same drift. Fix it upstream.

Test plan

  • CI green (devkit's own coverage continues to pass — change is additive, only raises the cap)
  • After merge + propagation: trawl_node build(deps-dev): bump eslint from 7.11.0 to 7.12.0 #1073 update branch passes coverage with the upstream value, downstream package.json patch from commit 042fdc9e becomes redundant and can be dropped on the next /update-stack

Related

Summary by CodeRabbit

  • Chores
    • Improved memory allocation for test coverage execution.

…OOM under --runInBand

`test:coverage` runs `jest --runInBand` (single Node process) so
`workerIdleMemoryLimit` from #3550 does not apply — there are no worker
children to recycle. Without an explicit heap cap, Node defaults to ~2 GB
old-space which is enough for devkit (~18 suites) but immediately OOMs on
larger downstream test suites (trawl_node hit OOM at 1.9 GB on 214 suites).

Setting `--max-old-space-size=6144` matches the existing per-project
override that downstream projects had to maintain locally as patches.
Bumping it upstream eliminates the divergence and prevents the
`feedback_update_stack_theirs_wipes_patches` failure mode where
`/update-stack --theirs` silently strips the override.

Sized for the largest known downstream (trawl_node ~214 suites peaks ~4.3 GB
pre-fixes / ~2 GB post). Headroom keeps room for further growth without
re-tuning. CI runners on lily ARC have ≥6 GiB, GitHub-hosted runners have
7 GiB — both fit.

Note: `workerIdleMemoryLimit: '512MB'` from #3550 still applies for non-
coverage parallel runs (`test:parallel-smoke`, etc.) where worker children
exist.
Copilot AI review requested due to automatic review settings May 1, 2026 06:59
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 1, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: fcec8b3a-ef9d-41be-9ca4-50d976da5327

📥 Commits

Reviewing files that changed from the base of the PR and between 3afaf3c and d06a830.

📒 Files selected for processing (1)
  • package.json

Walkthrough

The test:coverage npm script's NODE_OPTIONS was updated to include --max-old-space-size=6144 alongside existing flags --experimental-vm-modules and --expose-gc for improved memory allocation during test coverage execution.

Changes

Cohort / File(s) Summary
Package Configuration
package.json
Added --max-old-space-size=6144 Node.js flag to the test:coverage script's NODE_OPTIONS for increased heap memory allocation during coverage tests.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main change—adding --max-old-space-size=6144 to prevent OOM during test coverage runs.
Description check ✅ Passed The description provides comprehensive context covering what changed, why it's needed, and includes a detailed test plan and related issue references, meeting the template requirements.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/test-coverage-heap-cap

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

Comment @coderabbitai help to get the list of available commands and usage tips.

@codacy-production
Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

AI Reviewer: first review requested successfully. AI can make mistakes. Always validate suggestions.

Run reviewer

TIP This summary will be updated as you push new changes.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the repository’s coverage test script to raise Node’s V8 old-space heap limit, preventing out-of-memory crashes when running large Jest suites under --runInBand in downstream projects.

Changes:

  • Add --max-old-space-size=6144 to NODE_OPTIONS for test:coverage.

Copy link
Copy Markdown

@codacy-production codacy-production Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

The pull request successfully increases the Node.js heap memory limit to 6GB for the test:coverage script to prevent Out-Of-Memory errors in large test suites. Codacy analysis indicates the changes are up to standards with no new issues. However, there is a concern regarding the choice of 6GB on environments with 7GB total RAM (like GitHub Actions), as this leaves very little overhead for the OS and non-heap memory, potentially leading to non-deterministic SIGKILL failures. Additionally, several other scripts using --runInBand remain at default limits, which may lead to similar OOM issues in those contexts.

About this PR

  • The memory limit increase is currently only applied to test:coverage. Other scripts that utilize --runInBand (e.g., test:all, test:unit, test:integration) are still subject to default Node.js memory limits. Consider evaluating if these should also be updated to ensure consistency and prevent OOM errors across the entire test suite.

Test suggestions

  • Verify that 'test:coverage' command executes with the 6GB memory limit applied.
  • Verify that other in-band scripts (test:all, test:integration) are not causing OOM in downstream projects or evaluate if they also need the memory increase.
Prompt proposal for missing tests
Consider implementing these tests if applicable:
1. Verify that other in-band scripts (test:all, test:integration) are not causing OOM in downstream projects or evaluate if they also need the memory increase.

TIP Improve review quality by adding custom instructions
TIP How was this review? Give us feedback

Comment thread package.json
@codecov
Copy link
Copy Markdown

codecov Bot commented May 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.87%. Comparing base (3afaf3c) to head (d06a830).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3554   +/-   ##
=======================================
  Coverage   87.87%   87.87%           
=======================================
  Files         128      128           
  Lines        3589     3589           
  Branches     1054     1054           
=======================================
  Hits         3154     3154           
  Misses        345      345           
  Partials       90       90           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@PierreBrisorgueil PierreBrisorgueil merged commit a40e4c5 into master May 1, 2026
11 checks passed
@PierreBrisorgueil PierreBrisorgueil deleted the fix/test-coverage-heap-cap branch May 1, 2026 07:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants